import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from './components/home'
import Login from './components/login'
import Register from './components/register'
import PublishArticle from './components/publishArticle'
import Personal from './components/personal'
import ArticleDetails from './components/articleDetails'
import ForgetPassword  from './components/forgetPassword'
import Admin from './components/admin/admin'
import Chat from './components/chat'
import UserCenter from './components/userCenter'

Vue.use(VueRouter)


var routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home,
    name: '首 页'
  },
  {
    path: '/login',
    component: Login,
    name: '登陆页'
  },
  {
    path: '/register',
    component: Register,
    name: '注册页'
  },
  {
    path: '/publishArticle',
    component: PublishArticle,
    name: '发表文章'

  },
  {
    path: '/article/:id',
    component: ArticleDetails,
    name: '文章详情'
  },
  {
    path: '/personal/:id',
    component: Personal,
    name: '个人中心'
  },
  {
    path: '/userCenter/:id',
    component: UserCenter,
    name: '用户信息'
  },
  {
    path: '/forgetPassword',
    component: ForgetPassword,
    name: '找回密码'
  },
  {
    path: '/admin',
    component: Admin
  },
  {
    path: '/chat',
    component: Chat,
    name: '在线聊天室'
  }
]

var router = new VueRouter({routes,linkActiveClass: 'active'})

export default router